/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "centro_custo", catalog = "salao", schema = "public")
public class CentroCusto implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "centro_custo_id_custo_seq")
    @SequenceGenerator(name = "centro_custo_id_custo_seq", sequenceName = "centro_custo_id_custo_seq", initialValue = 1, allocationSize = 1)
    @Column(name = "id_custo")
    @JoinColumn(name = "id_custo",
    referencedColumnName = "id_custo",
    nullable = false,
    insertable = true,
    updatable = false)
    private Integer idCusto;
    @Column(name = "dsc_custo", length = 50,nullable = false)
    private String dscCusto;
    @Column(name = "tip_status")
    private Boolean tipStatus;
    /*
    @JoinTable(name = "centro_custo_departamento", joinColumns = {
        @JoinColumn(name = "id_custo", referencedColumnName = "id_custo", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "id_departamento", referencedColumnName = "id_departamento", nullable = false)})
    @ManyToMany
    private List<Departamento> departamentoList;
    */

    public CentroCusto() {
    }

    public CentroCusto(Integer idCusto) {
        this.idCusto = idCusto;
    }

    public Integer getIdCusto() {
        return idCusto;
    }

    public void setIdCusto(Integer idCusto) {
        this.idCusto = idCusto;
    }

    public String getDscCusto() {
        return dscCusto;
    }

    public void setDscCusto(String dscCusto) {
        this.dscCusto = dscCusto;
    }

    public Boolean getTipStatus() {
        return tipStatus;
    }

    public void setTipStatus(Boolean tipStatus) {
        this.tipStatus = tipStatus;
    }
/*
    public List<Departamento> getDepartamentoList() {
        return departamentoList;
    }

    public void setDepartamentoList(List<Departamento> departamentoList) {
        this.departamentoList = departamentoList;
    }
*/
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCusto != null ? idCusto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CentroCusto)) {
            return false;
        }
        CentroCusto other = (CentroCusto) object;
        if ((this.idCusto == null && other.idCusto != null) || (this.idCusto != null && !this.idCusto.equals(other.idCusto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.CentroCusto[ idCusto=" + idCusto + " ]";
    }
}
